package com.jjy.admin.mapper;

import com.jjy.admin.domain.JobEntity;
import com.jjy.admin.domain.TaskJob;
import com.jjy.admin.domain.TaskJobDTO;
import com.jjy.common.core.BaseMapperX;
import com.jjy.common.core.LambdaQueryWrapperX;
import com.jjy.common.domain.PageResult;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TaskJobMapper extends BaseMapperX<TaskJob> {

    default List<TaskJob> selectTaskList(TaskJob taskJob) {

        return selectList(new LambdaQueryWrapperX<TaskJob>()
                .eqIfPresent(TaskJob::getTaskType, taskJob.getTaskType())
                .eqIfPresent(TaskJob::getStatus, taskJob.getStatus())
        );
    }


    default PageResult<TaskJob> selectPage(TaskJobDTO taskJob) {
        return selectPage(  new LambdaQueryWrapperX<TaskJob>());
    }

    boolean  updateTaskSuccessStatusById(@Param("taskId")Long taskId);
    boolean  updateTaskFailStatusById(@Param("taskId")Long taskId);
}